<template>
	<view class="page">
		<view class="body">
			<uni-section title="商家昵称" type="line">
				<input type="text" placeholder="请输入昵称" class="input_css" v-model="name" />
			</uni-section>
			<uni-section title="商家手机号" type="line">
				<input type="text" placeholder="请输入商家手机号" class="input_css" v-model="phone" />
			</uni-section>
			<uni-section title="登录密码" type="line">
				<input type="password" placeholder="请输入密码" class="input_css" v-model="password" />
			</uni-section>
			<uni-section title="确认登录密码" type="line">
				<input type="password" placeholder="请输入密码" class="input_css" v-model="password2" />
			</uni-section>
			<uni-section title="费率" type="line">
				<input type="text" placeholder="请输入费率" class="input_css" v-model="rates" />
			</uni-section>
			<uni-section title="邀请人" type="line">
				<input type="text" placeholder="请输入邀请人" class="input_css" v-model="invite" />
			</uni-section>
			<uni-section title="商家类型" type="line">
				<input type="text" placeholder="请输入商家类型" class="input_css" v-model="type" />
			</uni-section>
			<view class="btn_css">
				<view class="btn" @click="btn">
					提交
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		addSviceShop
	} from '../../api/busList/index.js'
	export default {
		data() {
			return {
				name: '',
				phone: '',
				password: '',
				password2: '',
				rates: '',
				invite: '',
				type: ''
			}
		},
		methods: {
			// 新增商家
			btn() {
				const data = {
					shop_name: this.name,
					mobile: this.phone,
					password: this.password,
					rate: this.rates,
					user_role: "商家"
				}
				console.log("新增商家", data);
				addSviceShop(data).then(res => {
					uni.showToast({
						"icon": "none",
						"title": res.msg
					});
					setTimeout(function() {
						uni.navigateBack(-1)
					}, 1000);
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		height: 100%;

		.body {
			.input_css {
				background-color: #f5f6f9;
				padding: 30rpx;
				border-radius: 15rpx;
			}

			.btn_css {
				padding: 50px 0;
			}
		}
	}
</style>